< previous page page_325 next page >

Page 325
When accessing an ADO Recordset in the code, the Recordset object names are prefixed with rs to distinguish them from their respective Command objects. For example, a Command object named Order creates a Recordset object named rsOrder. Recordset objects are closed by default when the application is started and will be opened when the Recordset's corresponding Command method is executed. In addition, you can open a Recordset object directly by using the ADO Open method in the application code.
As a simple example of how to use the Data Environment to access data directly in your code, add a third command to the Data Environment as listed in Table 12.1. Then, add the controls listed in Table 12.2 to the default form, as shown in Figure 12.10.
TABLE 12.2. SAMPLE DATA ENVIRONMENT ACCESS FORM'S CONTROLS.
ControlPropertyValue
TextBoxNametxtEmployeeName
TextBoxNametxtEmpId
CommandNamecmdNext
CaptionNext
CommandNamecmdPrev
CaptionPrevious
CommandNamecmdQuit
CaptionQuit
LabelNamelblID
CaptionEmployee ID
LabelNamelblName
CaptionEmployee Name

12181-0325a.gif
Figure 12.10.
Creating a sample form to access the
database by using the Data
Environment connection.
For this example, one of the textboxes will be bound to the new command, whereas the other one will be updated by using program code. In addition, the two Command buttons will allow you to move forward and backward in the query to display the data. To bind the first textbox to the customer name, the properties in Table 12.3 need to be set.

 
< previous page page_325 next page >

If you like this book, buy it!